<template>
  <div>
    <h3>props传参</h3>
    <div>
      <h3>父组件</h3>
      <p>{{ count }}</p>
      <Child :count="count" :add="add" @sub="sub" />
      <!-- <button @click="count++">add</button> -->
    </div>
  </div>
</template>

<script>
import Child from "./Child.vue";
export default {
  name: "Props",
  data() {
    return {
      count: 0,
    };
  },
  methods: {
    add(value) {
      this.count += value;
    },
    sub(value) {
      this.count -= value;
    },
  },

  components: { Child },
};
</script>

<style>
</style>